<!doctype html>
<html>
<head>
<title>我的客户 - 销售员</title>
<meta charset="utf-8">
<link rel="stylesheet" href="./source/modules/broke/style/css/style.css"/>
<link rel="apple-touch-icon-precomposed" href="/img/ico-startup-57x57.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no" />
<meta name="format-detection" content="telephone=no,address=no,email=no" />
<meta name="mobileOptimized" content="width" />
<meta name="handheldFriendly" content="true" />
<meta http-equiv="Cache-Control" content="max-age=0" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
</head>
<body>
<section class="main animated fadeInDown">

	<div class="main-box">
		<div class="client-info fn-clear">
			<h1>{$customer['realname']}</h1>
			<div class="client-tel">
				<p><i class="icon icon-phone"></i>电话号码<span>{$customer['mobile']}</span></p>
				<p><i class="icon icon-location"></i>意向<span>{$pan[$customer['loupan']]}</span></p>
				<p><i class="icon icon-phone"></i> 推 荐 人<span>{$member['realname']}</span></p>
			</div>
		</div>
		
		<div class="call-to"><a href="tel:{$customer['mobile']}">呼叫Ta</a><a href="tel:{$member['mobile']}">呼叫推荐人</a></div>
		<div class="client-time border-box fn-clear" style="margin-bottom:10px;">
			<h1>充值</h1>
			<p><input id="commission" style="width:100%;min-height:30px;" placeholder="总佣金：{if empty($comm)}0{else}{$comm}{/if}" /></p>
			
			<h1>说明备注</h1>
			<p><textarea id="content" style="width:100%;min-height:60px;" placeholder="增加备注">{$customer['content']}</textarea></p>
		</div>			
		<div class="client-time border-box fn-clear">
			<div class="time-left">
				{$time_node}
			</div>
			
			<div class="time-right">
				<ul>
				{$time_detail}
				</ul>
			</div>
		</div>
		<input type="hidden" id="flag" value="{$customer['flag']}">
		<p class="rb-submit"><input type="button" value="提交" class="btn" id="J_submitReg"/></p>
	</div>
</section>

<footer class="foot"><a>&copy; {$_W['account']['name']}</a></footer>

<script src="http://libs.baidu.com/jquery/1.7.1/jquery.min.js"></script>
<script src="./source/modules/broke/style/js/com.js"></script>
<script src="./source/modules/broke/style/js/wx.js"></script>
<script type="text/javascript">

WeixinApi.ready(function(Api) {
        Api.showOptionMenu();
        var wxData = {
            "appId": "{$_W['account']['key']}",
            "imgUrl" : '{$_W['siteroot']}/source/modules/broke/icon.jpg',
            "link" : '{php echo $_W['siteroot'].$this->createMobileUrl('index',array('id'=>$id))}',
            "desc" : '看你能捞多少佣金',
            "title" : '全民经纪人-{$_W['account']['name']}'
        };
        // 分享的回调
        var wxCallbacks = {
            // 分享被用户自动取消
            cancel : function(resp) {
                TopBox.alert("分享后获得积分,还有可能得到佣金哦!不要错过发大财的机会!");
            },
            // 分享失败了
            fail : function(resp) {
                TopBox.alert("分享失败，可能是网络问题，一会儿再试试？");
            },
            // 分享成功
            confirm : function(resp) {
             TopBox.alert("分享后成功,等着收佣金吧!");
            },
        };
        Api.shareToFriend(wxData,wxCallbacks);
        Api.shareToTimeline(wxData,wxCallbacks);
        Api.shareToWeibo(wxData,wxCallbacks);
    });

	var statuss = $('input[name="status"]');
	if({$customer['status']}>2){
		statuss[{$customer['status']}-1].checked = true;
	}else{
		statuss[{$customer['status']}].checked = true;
	}
	
$("#J_submitReg").live("click", function () {

	var n = $("#content").val();
	var c = $("#commission").val();
	var f = $("#flag").val();
	var opp = '';
	var op = 'display';
	var oppp = '';
	if("{$opp}"=='his'){
		opp = 'visit';
		op = 'statussort';
		oppp = 'all';
	}
	var status = '';
	var cid = "{$cid}";
	var statuss = $('input[name="status"]');
	for (var i=0; i<statuss.length; i++){
		if(statuss[i].checked == true){
			var status = statuss[i].value;
			break;
		}
	}

	$.ajax({
		type: "POST",
		url: "{php echo $this->createMobileurl('counselor',array('op'=>'status'))}",
		data: { content: n, status: status, cid: cid, commission: c, flag: f, opp: opp},
		dataType: "text",
		
		success: function (d) {
			if (d == "1") {
				TopBox.alert("更新状态成功！", function () { window.location.href = '{php echo $this->createMobileurl('counselor')}&op='+op+'&opp='+opp+'&oppp='+oppp; });
				//TopBox.alert("经纪人申请成功.");
			} else if (d == "0") {
				TopBox.alert("更新状态失败！");
			}
		},
		
		error: function (xml, text, thrown) {
			TopBox.alert("出错啦!");
		}
	});

});
	
</script>
</body>
</html>